package moe.oil.db.repo;


import moe.oil.db.entity.Feedback;
import moe.oil.enumeration.FeedBackType;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;
import java.util.Optional;

public interface FeedbackRepo extends PagingAndSortingRepository<Feedback, Long> {
    //根据ID查询反馈
    Optional<Feedback> findByFeedbackId(Long userId);

    //根据反馈状态查询反馈
    List<Feedback> findFeedbackByStatus(FeedBackType feedBackEnum);

    //根据反馈id删除反馈
    @Modifying
    int deleteByFeedbackId(Long id);

    //根据反馈id和状态查询反馈
    Optional<Feedback> findByFeedbackIdAndStatus(Long id, FeedBackType feedBackEnum);

}
